// Arco Design 主题定制 - 基于官方设计令牌
// 参考：https://arco.design/vue/docs/token

:root {
  // ===== 色彩令牌 =====
  --color-bg-1: #ffffff;
  --color-bg-2: #f7f8fa;
  --color-bg-3: #f2f3f5;
  --color-bg-4: #e5e6eb;
  --color-bg-5: #c9cdd4;

  --color-fill-1: #f7f8fa;
  --color-fill-2: #f2f3f5;
  --color-fill-3: #e5e6eb;
  --color-fill-4: #c9cdd4;

  --color-text-1: #1d2129;
  --color-text-2: #4e5969;
  --color-text-3: #86909c;
  --color-text-4: #c9cdd4;

  --color-border-1: #f2f3f5;
  --color-border-2: #e5e6eb;
  --color-border-3: #c9cdd4;
  --color-border-4: #a9aeb8;

  // ===== 功能色彩 =====
  --color-primary-1: #e8f4ff;
  --color-primary-2: #bedaff;
  --color-primary-3: #94bfff;
  --color-primary-4: #6aa1ff;
  --color-primary-5: #4080ff;
  --color-primary-6: #165dff;
  --color-primary-7: #0e42d2;
  --color-primary-8: #062aa6;
  --color-primary-9: #031a7a;

  --color-success-6: #00b42a;
  --color-warning-6: #ff7d00;
  --color-danger-6: #f53f3f;
  --color-info-6: #0fc6c2;

  // ===== 间距令牌 =====
  --spacing-mini: 4px;
  --spacing-small: 8px;
  --spacing-medium: 16px;
  --spacing-large: 24px;
  --spacing-huge: 32px;

  // ===== 圆角令牌 =====
  --border-radius-small: 2px;
  --border-radius-medium: 4px;
  --border-radius-large: 6px;
  --border-radius-circle: 50%;

  // ===== 阴影令牌 =====
  --shadow-1: 0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px 0 rgba(0, 0, 0, 0.02);
  --shadow-2: 0 4px 10px 0 rgba(0, 0, 0, 0.04), 0 0 1px 0 rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-3: 0 10px 40px 0 rgba(0, 0, 0, 0.08), 0 2px 8px 0 rgba(0, 0, 0, 0.06), 0 0 1px 0 rgba(0, 0, 0, 0.04);

  // ===== 布局令牌 =====
  --layout-header-height: 60px;
  --layout-sider-width: 220px;
  --layout-sider-collapsed-width: 48px;

  // ===== 字体令牌 =====
  --font-size-body-1: 14px;
  --font-size-body-2: 13px;
  --font-size-body-3: 12px;
  --font-size-title-1: 16px;
  --font-size-title-2: 20px;
  --font-size-title-3: 24px;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  // ===== 动画令牌 =====
  --motion-duration-immediately: 0s;
  --motion-duration-fast: 0.1s;
  --motion-duration-normal: 0.2s;
  --motion-duration-slow: 0.3s;
  
  --motion-ease-linear: linear;
  --motion-ease-standard: cubic-bezier(0.34, 0.69, 0.1, 1);
  --motion-ease-in: cubic-bezier(0.4, 0, 1, 1);
  --motion-ease-out: cubic-bezier(0, 0, 0.2, 1);
}

// ===== 暗色主题支持 =====
[arco-theme='dark'] {
  --color-bg-1: #17171a;
  --color-bg-2: #232324;
  --color-bg-3: #2a2a2b;
  --color-bg-4: #313132;
  --color-bg-5: #373739;

  --color-text-1: rgba(255, 255, 255, 0.9);
  --color-text-2: rgba(255, 255, 255, 0.65);
  --color-text-3: rgba(255, 255, 255, 0.45);
  --color-text-4: rgba(255, 255, 255, 0.25);

  --color-border-1: #2e2e30;
  --color-border-2: #3c3c3f;
  --color-border-3: #4a4a4d;
  --color-border-4: #585858;
}

// ===== 组件定制 =====
// 卡片组件优化
.arco-card {
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--motion-duration-normal) var(--motion-ease-standard);

  &:hover {
    box-shadow: var(--shadow-2);
  }

  .arco-card-header {
    border-bottom: 1px solid var(--color-border-2);
    
    .arco-card-header-title {
      font-weight: var(--font-weight-semibold);
    }
  }
}

// 按钮组件优化  
.arco-btn {
  border-radius: var(--border-radius-large);
  font-weight: var(--font-weight-medium);
  transition: all var(--motion-duration-normal) var(--motion-ease-standard);

  &.arco-btn-primary {
    background: var(--color-primary-6);
    border-color: var(--color-primary-6);

    &:hover {
      background: var(--color-primary-5);
      border-color: var(--color-primary-5);
    }

    &:focus {
      background: var(--color-primary-5);
      border-color: var(--color-primary-5);
    }
  }

  &.arco-btn-outline {
    &.arco-btn-primary {
      color: var(--color-primary-6);
      border-color: var(--color-primary-6);
      background: transparent;

      &:hover {
        color: var(--color-primary-5);
        border-color: var(--color-primary-5);
        background: var(--color-primary-1);
      }
    }
  }
}

// 表格组件优化
.arco-table {
  .arco-table-th {
    background-color: var(--color-fill-1);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-2);
  }

  .arco-table-tr:hover {
    background-color: var(--color-fill-1);
  }
}

// 菜单组件优化 - 修复对比度问题
.arco-menu-dark {
  background: linear-gradient(180deg, #001529 0%, #002140 100%);
  
  .arco-menu-item,
  .arco-menu-submenu-title {
    color: rgba(255, 255, 255, 0.85);
    border-radius: var(--border-radius-medium);
    margin: 2px var(--spacing-small);
    transition: all var(--motion-duration-normal) var(--motion-ease-standard);

    &:hover {
      background-color: rgba(255, 255, 255, 0.1);
      color: rgba(255, 255, 255, 0.95);
    }

    &.arco-menu-selected {
      background: var(--color-primary-6) !important;
      color: white !important;
      font-weight: var(--font-weight-medium);
      box-shadow: 0 2px 8px rgba(22, 93, 255, 0.3);
      
      &::after {
        display: none;
      }
    }

    .arco-menu-icon {
      margin-right: var(--spacing-small);
    }
  }

  .arco-menu-submenu {
    .arco-menu-item {
      margin-left: var(--spacing-large);
      position: relative;
      
      &::before {
        content: '';
        position: absolute;
        left: -12px;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.4);
      }

      &.arco-menu-selected::before {
        background: white;
      }
    }
  }

  // 展开的子菜单样式
  .arco-menu-submenu-header.arco-menu-selected {
    background: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.95) !important;
  }
}

// 输入框组件优化
.arco-input-wrapper,
.arco-select-view,
.arco-picker {
  border-radius: var(--border-radius-large);
  transition: all var(--motion-duration-normal) var(--motion-ease-standard);

  &:hover {
    border-color: var(--color-primary-4);
  }

  &.arco-input-focus,
  &.arco-select-focus {
    border-color: var(--color-primary-6);
    box-shadow: 0 0 0 2px var(--color-primary-1);
  }
}

// 统计数据组件
.arco-statistic {
  .arco-statistic-value {
    font-weight: var(--font-weight-bold);
  }

  .arco-statistic-title {
    color: var(--color-text-3);
    font-weight: var(--font-weight-medium);
  }
}

// 全局组件样式增强
.arco-card {
  border-radius: var(--border-radius-large) !important;
  box-shadow: var(--shadow-2) !important;
  border: 1px solid var(--color-border-2) !important;
  transition: all var(--motion-duration-normal) var(--motion-ease-standard) !important;
  background: var(--color-bg-1) !important;

  &:hover {
    box-shadow: var(--shadow-3) !important;
    transform: translateY(-1px) !important;
  }

  .arco-card-header {
    border-bottom: 1px solid var(--color-border-1) !important;
    padding: var(--spacing-large) var(--spacing-large) var(--spacing-medium) !important;

    .arco-card-header-title {
      font-size: var(--font-size-title-1) !important;
      font-weight: 600 !important;
      color: var(--color-text-1) !important;
    }

    .arco-card-header-extra {
      color: var(--color-text-3) !important;
      font-size: var(--font-size-body-2) !important;
    }
  }

  .arco-card-body {
    padding: var(--spacing-large) !important;
  }
}

.arco-btn {
  border-radius: var(--border-radius-medium) !important;
  font-weight: 500 !important;
  transition: all var(--motion-duration-normal) var(--motion-ease-standard) !important;
  box-shadow: var(--shadow-1) !important;

  &:hover {
    transform: translateY(-1px) !important;
    box-shadow: var(--shadow-2) !important;
  }

  &.arco-btn-primary {
    background: linear-gradient(135deg, var(--color-primary-6), var(--color-primary-7)) !important;
    border: none !important;

    &:hover {
      background: linear-gradient(135deg, var(--color-primary-5), var(--color-primary-6)) !important;
    }
  }

  &.arco-btn-outline {
    border: 1px solid var(--color-border-3) !important;
    background: var(--color-bg-1) !important;
    color: var(--color-text-1) !important;

    &:hover {
      border-color: var(--color-primary-6) !important;
      color: var(--color-primary-6) !important;
    }
  }
}

.arco-input-wrapper {
  border-radius: var(--border-radius-medium) !important;
  border: 1px solid var(--color-border-2) !important;
  transition: all var(--motion-duration-normal) var(--motion-ease-standard) !important;
  background: var(--color-bg-1) !important;

  &:hover {
    border-color: var(--color-border-3) !important;
  }

  &.arco-input-focus {
    border-color: var(--color-primary-6) !important;
    box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1) !important;
  }

  .arco-input {
    color: var(--color-text-1) !important;

    &::placeholder {
      color: var(--color-text-3) !important;
    }
  }
}

.arco-select-view {
  border-radius: var(--border-radius-medium) !important;
  border: 1px solid var(--color-border-2) !important;
  transition: all var(--motion-duration-normal) var(--motion-ease-standard) !important;
  background: var(--color-bg-1) !important;

  &:hover {
    border-color: var(--color-border-3) !important;
  }

  &.arco-select-view-focus {
    border-color: var(--color-primary-6) !important;
    box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1) !important;
  }
}

.arco-table {
  border-radius: var(--border-radius-large) !important;
  overflow: hidden !important;
  box-shadow: var(--shadow-2) !important;
  background: var(--color-bg-1) !important;

  .arco-table-th {
    background-color: var(--color-bg-2) !important;
    font-weight: 600 !important;
    color: var(--color-text-1) !important;
    border-bottom: 1px solid var(--color-border-2) !important;
  }

  .arco-table-td {
    border-bottom: 1px solid var(--color-border-1) !important;
    color: var(--color-text-1) !important;
  }

  .arco-table-tr:hover .arco-table-td {
    background-color: var(--color-bg-2) !important;
  }
}

.arco-list {
  .arco-list-item {
    border-bottom: 1px solid var(--color-border-1) !important;
    transition: all var(--motion-duration-normal) var(--motion-ease-standard) !important;

    &:hover {
      background-color: var(--color-bg-2) !important;
    }

    &:last-child {
      border-bottom: none !important;
    }
  }
}

.arco-statistic {
  .arco-statistic-title {
    color: var(--color-text-2) !important;
    font-size: var(--font-size-body-2) !important;
    font-weight: 500 !important;
    margin-bottom: var(--spacing-small) !important;
  }

  .arco-statistic-content {
    .arco-statistic-value {
      font-weight: 700 !important;
      font-size: 28px !important;
    }
  }
}

.arco-tag {
  border-radius: var(--border-radius-small) !important;
  font-weight: 500 !important;
  border: none !important;
}

.arco-avatar {
  box-shadow: var(--shadow-1) !important;
}

.arco-modal {
  .arco-modal-wrapper {
    background: var(--color-bg-1) !important;
  }

  .arco-modal-header {
    border-bottom: 1px solid var(--color-border-1) !important;
    padding: var(--spacing-large) var(--spacing-large) var(--spacing-medium) !important;

    .arco-modal-title {
      font-size: var(--font-size-title-1) !important;
      font-weight: 600 !important;
      color: var(--color-text-1) !important;
    }
  }

  .arco-modal-body {
    padding: var(--spacing-large) !important;
    color: var(--color-text-1) !important;
  }

  .arco-modal-footer {
    border-top: 1px solid var(--color-border-1) !important;
    padding: var(--spacing-medium) var(--spacing-large) var(--spacing-large) !important;
  }
}

// 布局组件增强
.arco-layout {
  .arco-layout-sider {
    box-shadow: var(--shadow-2) !important;
    background: var(--color-bg-1) !important;
  }

  .arco-layout-header {
    box-shadow: var(--shadow-1) !important;
    backdrop-filter: blur(8px) !important;
    background: rgba(255, 255, 255, 0.95) !important;
  }
}

// 暗色模式下的布局特殊处理
.dark .arco-layout .arco-layout-header {
  background: rgba(23, 23, 26, 0.95) !important;
}

// 菜单组件增强
.arco-menu {
  background: var(--color-bg-1) !important;

  .arco-menu-item {
    border-radius: var(--border-radius-medium) !important;
    margin: 2px var(--spacing-small) !important;
    transition: all var(--motion-duration-normal) var(--motion-ease-standard) !important;
    color: var(--color-text-2) !important;

    &:hover {
      background-color: var(--color-primary-1) !important;
      color: var(--color-primary-6) !important;
    }

    &.arco-menu-selected {
      background: linear-gradient(135deg, var(--color-primary-6), var(--color-primary-7)) !important;
      color: white !important;
      box-shadow: var(--shadow-2) !important;
    }
  }
}

// 面包屑增强
.arco-breadcrumb {
  .arco-breadcrumb-item {
    .arco-breadcrumb-item-link {
      color: var(--color-text-2) !important;
      transition: all var(--motion-duration-normal) var(--motion-ease-standard) !important;

      &:hover {
        color: var(--color-primary-6) !important;
      }
    }

    &:last-child .arco-breadcrumb-item-link {
      color: var(--color-text-1) !important;
      font-weight: 600 !important;
    }
  }
}

// 下拉菜单增强
.arco-dropdown {
  .arco-dropdown-list {
    border-radius: var(--border-radius-large) !important;
    box-shadow: var(--shadow-3) !important;
    border: 1px solid var(--color-border-2) !important;
    padding: var(--spacing-small) !important;
    background: var(--color-bg-1) !important;

    .arco-dropdown-option {
      border-radius: var(--border-radius-medium) !important;
      margin: 2px 0 !important;
      transition: all var(--motion-duration-normal) var(--motion-ease-standard) !important;
      color: var(--color-text-1) !important;

      &:hover {
        background-color: var(--color-bg-2) !important;
      }
    }
  }
}

// 滚动条美化
::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-2) !important;
  border-radius: var(--border-radius-small) !important;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-3) !important;
  border-radius: var(--border-radius-small) !important;
  transition: all var(--motion-duration-normal) var(--motion-ease-standard) !important;

  &:hover {
    background: var(--color-border-4) !important;
  }
}

// 响应式设计增强
@media (max-width: 768px) {
  .arco-card {
    .arco-card-header,
    .arco-card-body {
      padding: var(--spacing-medium) !important;
    }
  }

  .arco-table {
    font-size: var(--font-size-body-2) !important;
  }
}

// 动画增强
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.arco-card,
.arco-table,
.arco-list {
  animation: fadeInUp var(--motion-duration-slow) var(--motion-ease-out) !important;
}

// 主题切换动画
html {
  transition: background-color var(--motion-duration-slow) var(--motion-ease-standard) !important;
}

* {
  transition: background-color var(--motion-duration-normal) var(--motion-ease-standard),
              border-color var(--motion-duration-normal) var(--motion-ease-standard),
              color var(--motion-duration-normal) var(--motion-ease-standard) !important;
} 